import { serviceApiPrefix } from "@/common/serviceConfig";
import { appFetch } from "@/utils/tools";


export const getRolesPaginationApi = (body: any) => appFetch(
  `${serviceApiPrefix}/roles/getRolesPagination`,
  {
    method: 'post',
    body: JSON.stringify(body)
  }
)

export const getAllRolesApi = () => appFetch(
  `${serviceApiPrefix}/roles/getAllRoles`,
  {
    method: 'post'
  }
)

export const addAndUpdateRoleApi = (body = {}) => appFetch(
  `${serviceApiPrefix}/roles/addAndUpdateRole`,
  {
    method: 'post',
    body: JSON.stringify(body)
  }
)
export const setRoleOffByIdApi = (id: string, off: boolean) => appFetch(
  `${serviceApiPrefix}/roles/setRoleOffById/${id}`,
  {
    method: 'put',
    body: JSON.stringify({ off })
  }
)

export const deleteRoleApi = (ids: string[]) => appFetch(
  `${serviceApiPrefix}/roles/deleteRoles`,
  {
    method: 'delete',
    body: JSON.stringify({
      ids
    })
  }
)